#include <iostream>
using namespace std;

const long long kInf = 1e18;
const int kMaxN = 2e5 + 10;
const int kMaxM = 2e5 + 10;

int a[kMaxM], b[kMaxM], c[kMaxM];
long long dis[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  fill(dis, dis + n + 1, kInf);
  dis[1] = 0;
  for (int i = 1; i <= m; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }
  for (int i = 0; i < k; i++) {
    int e;

    cin >> e;
    dis[b[e]] = min(dis[b[e]], dis[a[e]] + c[e]);
  }
  if (dis[n] == kInf) {
    cout << "-1\n";
  } else {
    cout << dis[n] << "\n";
  }
  return 0;
}